package net.daum.webtoon.android;

import java.io.Serializable;

import android.util.Log;

public class WebToonInfo implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 101L;
	String eng_id;
	String title;
	String writer;
	String thumb_url;
	int thumb_w;
	int thumb_h;
	String toon_url;
	String writer_url;

	public static String TAG = WebToonInfo.class.getSimpleName();

	public WebToonInfo(String aInfoString) {

		String mainString = aInfoString.replace(">", ">\n").replace("<span ", "").replace("</span>", "").replace("<li>", "").replace("<strong>", "")
				.replace("</li>", "").replace("</strong>", "");
		String[] linfostr = mainString.split("\n");
		{
			this.eng_id = linfostr[0].trim().split("/")[3].replace("\">", "");
		}
		{
			String[] subStrs = linfostr[2].trim().replace("alt", "").replace("height", "").replace("width", "").replace("class", "").split("=\"");

			this.thumb_url = subStrs[1].replace("\"", "").trim();
			this.thumb_w = Integer.parseInt(subStrs[2].replace("\"", "").trim());
			this.thumb_h = Integer.parseInt(subStrs[3].replace("\"", "").trim());
		}
		{
			String[] subStrs = linfostr[14].trim().replace("class", "").replace("\">", "").split("=\"");
			this.title = subStrs[3];
			this.toon_url = subStrs[1].replace("\"", "").trim();
		}
		{
			String[] subStrs = linfostr[19].trim().replace("class", "").replace("\">", "").split("=\"");
			this.writer = subStrs[3];
			this.writer_url = subStrs[1].replace("\"", "").trim();
		}
//		printText();
	}

	public void printText() {

		Log.d(TAG, "String eng_id ==" + eng_id);
		Log.d(TAG, "String title == " + title);
		Log.d(TAG, "String writer == " + writer);
		Log.d(TAG, "String thumb_url == " + thumb_url);
		Log.d(TAG, "String writer == " + thumb_w);
		Log.d(TAG, "String thumb_w == " + thumb_h);
		Log.d(TAG, "String toon_url == " + toon_url);
		Log.d(TAG, "String writer_url == " + writer_url);
	}
}
